package com.hex.ds.hdtp.core.web.metadata.controller;

import com.hex.ds.hdtp.core.app.metadata.service.ISourceConfInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Package: com.hex.hdc.center.web.metadata.controller
 * @ClassName SourceConfInfoController
 * @Description: 数据源连接配置
 * @Author: wz.li
 * @Date 2022/5/9 15:34
 * @Version v2.0.2
 **/
@Slf4j
@RestController
@Api(tags = "00-准备工作：获取数据源配置（通用）")
@RequestMapping("/api/sourceConfInfo")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SourceConfInfoController {

    private final ISourceConfInfoService sourceConfInfoService;

    /*
     * @Method: findListBySourceCode <br>
     * @Param: [sourceCode] <br>
     * @Return: org.springframework.http.ResponseEntity <br>
     * @Description：获取指定数据源连接配置<br>
     * @Author： wz.li<br>
     * @Date： 2022/5/9 15:34 <br>
     * @Version： V2.0.2<br>
     */
    @GetMapping(value = {"/{sourceCode}"})
    @ApiOperation("通过数据源编码获取数据源配置")
    public ResponseEntity findListBySourceCode(@PathVariable("sourceCode") String sourceCode) {
        log.info("进入【SourceConfInfoController.findListBySourceCode】方法, 参数" + sourceCode);
        return ResponseEntity.ok(sourceConfInfoService.queryListBySourceCode(sourceCode));
    }

}
